
    <main class="lyear-layout-content">

        <div class="container-fluid p-t-15">

            <div class="row">
                <div class="col-lg-12">
                    <div class="card">
                        <div class="card-header">
                            <h4>线形图</h4>
                        </div>
                        <div class="card-body">
                            <canvas id="chart-line-4" width="300" height="150"></canvas>
                        </div>
                    </div>
                </div>
            </div>

        </div>

    </main>

    <script type="text/javascript">
        $.ajax({
        url: `{:url('admin/analysis/post')}`,
        type: 'post',
        data: { action: 'line' },
        dataType: 'json',
        success: function (success) {
            //帖子分类的名字
            let name = success.data.name
            let Accept = success.data.Accept
            let NoAccept = success.data.NoAccept
            // type: 'line' 线性图
            new Chart($("#chart-line-4"), {
                type: 'line',
                data: {
                    labels: name,
                    datasets: [
                        {
                            label: "采纳",
                            fill: false,
                            borderWidth: 4,
                            pointRadius: 4,
                            borderColor: "#36a2eb",
                            backgroundColor: "#36a2eb",
                            pointBackgroundColor: "#36a2eb",
                            pointBorderColor: "#36a2eb",
                            pointHoverBackgroundColor: "#fff",
                            pointHoverBorderColor: "#36a2eb",
                            data: Accept,  //X轴对应的值
                        },
                        {
                            label: "未采纳",
                            fill: false,
                            borderWidth: 4,
                            pointRadius: 4,
                            borderColor: "#ff6384",
                            backgroundColor: "#ff6384",
                            pointBackgroundColor: "#ff6384",
                            pointBorderColor: "#ff6384",
                            pointHoverBackgroundColor: "#fff",
                            pointHoverBorderColor: "#ff6384",
                            data: NoAccept //X轴对应的值
                        }
                    ]
                },
                options: {

                }
            });
        }
    })
    </script>
